home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / giochi / amigainf.lha / Inform / library / verblib.h < prev   
Text File  |  1995-08-02  |  61KB  |  1,842 lines

  1. ! ----------------------------------------------------------------------------
  2. !  VERBLIB:  A library of standard verb routines which run the universe...
  3. !
  4. !  Supplied for use with Inform 5                         Serial number 950703
  5. !                                                                 Release 5/11
  6. !  (c) Graham Nelson 1993, 1994, 1995, but freely usable (see documentation)
  7. !
  8. !  The actions provided are:
  9. !
  10. !    Quit, Restart, Restore, Verify, Save, ScriptOn/Off, NotifyOn/Off,
  11. !    Verbose, etc.,
  12. !    Inv, Take, Drop, Remove, PutOn, Insert, Transfer, Empty,
  13. !    Enter, Exit, GetOff, Go, Look, Examine, Give, Show, Search,
  14. !    Unlock, Lock, SwitchOn, SwitchOff, Open, Close, Disrobe, Wear, Eat;
  15. !
  16. !  and routines for verbs which by default only print a suitable reply:
  17. !
  18. !    Yes, No, Burn, Pray, Wake, WakeOther [person],
  19. !    Kiss, Think, Smell, Listen, Taste, Touch, Dig,
  20. !    Cut, Jump [jump on the spot], JumpOver, Tie, Drink,
  21. !    Fill, Sorry, Strong [swear word], Mild [swear word], Attack, Swim,
  22. !    Swing [something], Blow, Rub, Set, SetTo, WaveHands [ie, just "wave"],
  23. !    Wave [something], Pull, Push, PushDir [push something in a direction],
  24. !    Turn, Squeeze, LookUnder [look underneath something],
  25. !    ThrowAt, Answer, Buy, Ask, AskFor, Sing, Climb, Wait, Sleep, Consult
  26. !
  27. !  and the following routines may be of particular use:
  28. !
  29. !    EnglishNumber     Print out a number in English (lower case)
  30. !    WriteListFrom     The amazing list-writer
  31. !    PlayerTo          Safely move the player somewhere else
  32. !    YesOrNo           Ask the player a yes/no question, returning true if yes
  33. !
  34. ! ----------------------------------------------------------------------------
  35. ! ----------------------------------------------------------------------------
  36.  
  37. System_file;
  38.  
  39. Default MAX_CARRIED  100;
  40. Default MAX_SCORE    0;
  41. Default NUMBER_TASKS 1;
  42. Default OBJECT_SCORE 4;
  43. Default ROOM_SCORE   5;
  44. Default SACK_OBJECT  0;   
  45. Default AMUSING_PROVIDED 1;
  46. Default TASKS_PROVIDED   1;
  47.  
  48. ! ----------------------------------------------------------------------------
  49. !  First, printing a number n in English.
  50. !  It's this sort of thing which makes you realise just what an irregular
  51. !  language English is...
  52. ! ----------------------------------------------------------------------------
  53.  
  54. [ EnglishNumber n m f;
  55.   if (n==0) { print "zero"; rfalse; }
  56.   if (n<0) { print "minus "; n=-n; }
  57.   if (n>=1000) { EnglishNumber(n/1000); print " thousand"; n=n%1000; f=1; }
  58.   if (n>=100)  { if (f==1) print ", ";
  59.                  EnglishNumber(n/100); print " hundred"; n=n%100; f=1; }
  60.   if (n==0) rfalse;
  61.   if (f==1) print " and ";            ! Americans may want to delete this line
  62.   if (n<10) { EnglishDigit(n); rfalse; }
  63.   if (n>=20)
  64.   {   m=n/10;
  65.       if (m==2) print "twenty";
  66.       if (m==3) print "thirty";
  67.       if (m==4) print "forty";
  68.       if (m==5) print "fifty";
  69.       if (m==6) print "sixty";
  70.       if (m==7) print "seventy";
  71.       if (m==8) print "eighty";
  72.       if (m==9) print "ninety";
  73.       if (n%10==0) rfalse;
  74.       print "-"; EnglishDigit(n%10); rfalse;
  75.   }
  76.   if (n==10) { print "ten"; rfalse; }
  77.   if (n==11) { print "eleven"; rfalse; }
  78.   if (n==12) { print "twelve"; rfalse; }
  79.   if (n==13) { print "thirteen"; rfalse; }
  80.   if (n==14) { print "fourteen"; rfalse; }
  81.   if (n==15) { print "fifteen"; rfalse; }
  82.   if (n==16) { print "sixteen"; rfalse; }
  83.   if (n==17) { print "seventeen"; rfalse; }
  84.   if (n==18) { print "eighteen"; rfalse; }
  85.   print "nineteen";
  86. ];
  87.  
  88. [ EnglishDigit n;
  89.   if (n==1) { print "one"; rfalse; }
  90.   if (n==2) { print "two"; rfalse; }
  91.   if (n==3) { print "three"; rfalse; }
  92.   if (n==4) { print "four"; rfalse; }
  93.   if (n==5) { print "five"; rfalse; }
  94.   if (n==6) { print "six"; rfalse; }
  95.   if (n==7) { print "seven"; rfalse; }
  96.   if (n==8) { print "eight"; rfalse; }
  97.   if (n==9) { print "nine"; rfalse; }
  98. ];
  99.  
  100. ! ----------------------------------------------------------------------------
  101. !  Next the WriteListFrom routine, a flexible object-lister taking care of
  102. !  plurals, inventory information, various formats and so on.  This is used
  103. !  by everything in the library which ever wants to list anything.
  104. !
  105. !  If there were no objects to list, it prints nothing and returns false;
  106. !  otherwise it returns true.
  107. !
  108. !  o is the object, and style is a bitmap, whose bits are given by:
  109. ! ----------------------------------------------------------------------------
  110.  
  111. Constant NEWLINE_BIT    1;    !  New-line after each entry
  112. Constant INDENT_BIT     2;    !  Indent each entry by depth
  113. Constant FULLINV_BIT    4;    !  Full inventory information after entry
  114. Constant ENGLISH_BIT    8;    !  English sentence style, with commas and and
  115. Constant RECURSE_BIT   16;    !  Recurse downwards with usual rules
  116. Constant ALWAYS_BIT    32;    !  Always recurse downwards
  117. Constant TERSE_BIT     64;    !  More terse English style
  118. Constant PARTINV_BIT  128;    !  Only brief inventory information after entry
  119. Constant DEFART_BIT   256;    !  Use the definite article in list
  120. Constant WORKFLAG_BIT 512;    !  At top level (only), only list objects
  121.                               !  which have the "workflag" attribute
  122. Constant ISARE_BIT   1024;    !  Print " is" or " are" before list
  123. Constant CONCEAL_BIT 2048;    !  Omit objects with "concealed" or "scenery":
  124.                               !  if WORKFLAG_BIT also set, then does _not_
  125.                               !  apply at top level, but does lower down
  126. Constant NOARTICLE_BIT 4096;  !  Print no articles, definite or not
  127.  
  128. [ NextEntry o depth;
  129.   o=sibling(o);
  130.   if (lt_value~=0)
  131.   {   if (c_style & WORKFLAG_BIT ~= 0 && depth==0)
  132.       {   while (o~=0 && (o.list_together~=lt_value
  133.                           || o hasnt workflag)) o=sibling(o);
  134.           return o;
  135.       }
  136.       if (c_style & CONCEAL_BIT ~= 0)
  137.       {   while (o~=0 &&
  138.                  (o has concealed || o has scenery
  139.                   || o.list_together~=lt_value)) o=sibling(o);
  140.           return o;
  141.       }
  142.       while (o~=0 && o.list_together~=lt_value) o=sibling(o);
  143.       return o;
  144.   }
  145.   if (c_style & WORKFLAG_BIT ~= 0 && depth==0)
  146.   {   while (o~=0 && o hasnt workflag) o=sibling(o);
  147.       return o;
  148.   }
  149.   if (c_style & CONCEAL_BIT ~= 0)
  150.       while (o~=0 && (o has concealed || o has scenery)) o=sibling(o);
  151.   return o;
  152. ];
  153.  
  154. [ WillRecurs o;
  155.   if (c_style & ALWAYS_BIT ~= 0) rtrue;
  156.   if (c_style & RECURSE_BIT == 0) rfalse;
  157.   if (o has transparent
  158.       || o has supporter
  159.       || (o has container && o has open)) rtrue;
  160.   rfalse;
  161. ];
  162.  
  163. [ ListEqual o1 o2;
  164.   if (child(o1)~=0 && WillRecurs(o1)~=0) rfalse;
  165.   if (child(o2)~=0 && WillRecurs(o2)~=0) rfalse;
  166.  
  167.   if (c_style & (FULLINV_BIT + PARTINV_BIT) ~= 0)
  168.   {   if ((o1 hasnt worn && o2 has worn)
  169.           || (o2 hasnt worn && o1 has worn)) rfalse;
  170.       if ((o1 hasnt light && o2 has light)
  171.           || (o2 hasnt light && o1 has light)) rfalse;
  172.   }
  173.  
  174.   return Identical(o1,o2);
  175. ];
  176.  
  177. [ SortTogether obj value;
  178. !  print "Sorting together possessions of ",
  179. !         object obj, " by value ", value, "^";
  180.   while (child(obj)~=0)
  181.   {   if (child(obj).list_together~=value) move child(obj) to n_obj;
  182.       else move child(obj) to s_obj;
  183.   }
  184.   while (child(s_obj)~=0)
  185.       move child(s_obj) to obj;
  186.   while (child(n_obj)~=0)
  187.       move child(n_obj) to obj;
  188. ];
  189.  
  190. [ SortOutList obj i flag k l;
  191.   flag=1;
  192.   while (flag == 1)
  193.   {   flag=0;
  194.       for (i=obj:i~=0:i=sibling(i))
  195.       {   k=i.list_together;
  196.           if (k~=0)
  197.           {   for (i=sibling(i):i~=0 && i.list_together==k:) i=sibling(i);
  198.               if (i==0) rtrue;
  199.               for (l=sibling(i):l~=0:l=sibling(l))
  200.                   if (l.list_together==k)
  201.                   {   SortTogether(parent(obj), k);
  202.                       flag=1; i=0;
  203.                   }
  204.           }
  205.       }
  206.   }
  207. ];
  208.  
  209. [ WriteListFrom o style depth;
  210.   if (o==child(parent(o)))
  211.   {   SortOutList(o); o=child(parent(o)); }
  212.   c_style=style;
  213.   if (style & WORKFLAG_BIT ~= 0)
  214.   {   while (o~=0 && o hasnt workflag) o=sibling(o);
  215.   }
  216.   else
  217.   {   if (c_style & CONCEAL_BIT ~= 0)
  218.           while (o~=0 && (o has concealed || o has scenery)) o=sibling(o);
  219.   }
  220.   if (o==0) rfalse;
  221.   WriteListR(o,depth);
  222.   rtrue;
  223. ];
  224.  
  225. [ WriteListR o depth stack_pointer  classes_p sizes_p i j k k2 l m n q senc mr;
  226.  
  227.   if (depth>0 && o==child(parent(o)))
  228.   {   SortOutList(o); o=child(parent(o)); }
  229.  
  230.   classes_p = match_classes + stack_pointer;
  231.   sizes_p   = match_list + stack_pointer;
  232.  
  233.   for (i=o,j=0:i~=0 && (j+stack_pointer)<128:i=NextEntry(i,depth),j++)
  234.   {   classes_p->j=0;
  235.       if (i.plural~=0) k++;
  236.   }
  237.  
  238.   if (c_style & ISARE_BIT ~= 0)
  239.   {   if (j==1) print " is"; else print " are";
  240.       if (c_style & NEWLINE_BIT ~= 0) print ":^"; else print char ' ';
  241.       c_style = c_style - ISARE_BIT;
  242.   }
  243.  
  244.   stack_pointer = stack_pointer+j+1;
  245.  
  246.   if (k<2) jump EconomyVersion;   ! It takes two to plural
  247.  
  248.   n=1;
  249.   for (i=o,k=0:k<j:i=NextEntry(i,depth),k++)
  250.       if (classes_p->k==0)
  251.       {   classes_p->k=n; sizes_p->n=1;
  252.           for (l=NextEntry(i,depth), m=k+1:l~=0 && m<j:
  253.                l=NextEntry(l,depth), m++)
  254.               if (classes_p->m==0 && i.plural~=0 && l.plural~=0)
  255.               {   if (ListEqual(i,l)==1)
  256.                   {   sizes_p->n = sizes_p->n + 1;
  257.                       classes_p->m = n;
  258.                   }
  259.               }
  260.           n++;
  261.       }
  262.   n--;
  263.  
  264.   for (i=1, j=o, k=0: i<=n: i++, senc++)
  265.   {   while (((classes_p->k) ~= i)
  266.              && ((classes_p->k) ~= -i)) { k++; j=NextEntry(j,depth); }
  267.       m=sizes_p->i;
  268.       if (j.list_together~=0 or lt_value
  269.           && ZRegion(j.list_together)==2 or 3
  270.           && j.list_together==mr) senc--;
  271.       mr=j.list_together;
  272.   }
  273.   senc--;
  274.   for (i=1, j=o, k=0, mr=0: senc>=0: i++, senc--)
  275.   {   while (((classes_p->k) ~= i)
  276.              && ((classes_p->k) ~= -i)) { k++; j=NextEntry(j,depth); }
  277.       if (j.list_together~=0 or lt_value)
  278.       {   if (j.list_together==mr) { senc++; jump Omit_FL2; }
  279.           k2=NextEntry(j,depth);
  280.           if (k2==0 || k2.list_together~=j.list_together) jump Omit_WL2;
  281.           k2=ZRegion(j.list_together);
  282.           if (k2==2 or 3)
  283.           {   q=j; listing_size=1; l=k; m=i;
  284.               while (m<n && q.list_together==j.list_together)
  285.               {   m++;
  286.                   while (((classes_p->l) ~= m)
  287.                          && ((classes_p->l) ~= -m))
  288.                   {   l++; q=NextEntry(q,depth); }
  289.                   if (q.list_together==j.list_together) listing_size++;
  290.               }
  291. !              print " [", listing_size, "] ";
  292.               if (listing_size==1) jump Omit_WL2;
  293.               if (c_style & INDENT_BIT ~= 0) spaces 2*depth;
  294.               if (k2==3)
  295.               {   q=0; for (l=0:l<listing_size:l++) q=q+sizes_p->(l+i);
  296.                   EnglishNumber(q); print " ";
  297.                   print_paddr j.list_together;
  298.                   if (c_style & ENGLISH_BIT ~= 0) print " (";
  299.                   if (c_style & INDENT_BIT ~= 0) print ":^";
  300.                   q=c_style;
  301.               }
  302.               else
  303.               {   inventory_stage=1;
  304.                   parser_one=j; parser_two=depth; q=c_style;
  305.                   RunRoutines(j,list_together);
  306.               }
  307.               lt_value=j.list_together; listing_together=j;
  308.               WriteListR(j,depth+1,stack_pointer);
  309.               lt_value=0; listing_together=0;
  310.               l=0;
  311.               if (c_style & NEWLINE_BIT == 0 && q & NEWLINE_BIT ~= 0) l=1;
  312.               c_style=q;
  313.               if (k2==3)
  314.               {   if (c_style & ENGLISH_BIT ~= 0) print ")";
  315.               }
  316.               else
  317.               {   inventory_stage=2;
  318.                   parser_one=j; parser_two=depth;
  319.                   RunRoutines(j,list_together);
  320.               }
  321.               if (l==1) new_line;
  322.               mr=j.list_together;
  323.               jump Omit_EL2;
  324.           }
  325.       }
  326.  
  327.      .Omit_WL2;
  328.       WriteBeforeEntry(j,depth);
  329.       if (sizes_p->i == 1)
  330.       {   if (c_style & NOARTICLE_BIT ~= 0) PrintShortName(j);
  331.           else
  332.           {   if (c_style & DEFART_BIT ~= 0) DefArt(j); else InDefArt(j);
  333.           }
  334.       }
  335.       else
  336.       {   if (c_style & DEFART_BIT ~= 0) print "the ";
  337.           EnglishNumber(sizes_p->i); print " ";
  338.           PrintOrRun(j,plural,1);
  339.       }
  340.       WriteAfterEntry(j,depth,stack_pointer);
  341.  
  342.      .Omit_EL2;
  343.       if (c_style & ENGLISH_BIT ~= 0)
  344.       {   if (senc==1) print " and ";
  345.           if (senc>1) print ", ";
  346.       }
  347.      .Omit_FL2;
  348.   }
  349.   rtrue;
  350.  
  351.   .EconomyVersion;
  352.  
  353.   n=j;
  354.  
  355.   for (i=1, j=o: i<=n: j=NextEntry(j,depth), i++, senc++)
  356.   {   if (j.list_together~=0 or lt_value
  357.           && ZRegion(j.list_together)==2 or 3
  358.           && j.list_together==mr) senc--;
  359.       mr=j.list_together;
  360.   }
  361.  
  362.   for (i=1, j=o, mr=0: i<=senc: j=NextEntry(j,depth), i++)
  363.   {   if (j.list_together~=0 or lt_value)
  364.       {   if (j.list_together==mr) { i--; jump Omit_FL; }
  365.           k=NextEntry(j,depth);
  366.           if (k==0 || k.list_together~=j.list_together) jump Omit_WL;
  367.           k=ZRegion(j.list_together);
  368.           if (k==2 or 3)
  369.           {   if (c_style & INDENT_BIT ~= 0) spaces 2*depth;
  370.               if (k==3)
  371.               {   q=j; l=0;
  372.                   do
  373.                   {   q=NextEntry(q,depth); l++;
  374.                   } until (q.list_together~=j.list_together);
  375.                   EnglishNumber(l); print " ";
  376.                   print_paddr j.list_together;
  377.                   if (c_style & ENGLISH_BIT ~= 0) print " (";
  378.                   if (c_style & INDENT_BIT ~= 0) print ":^";
  379.                   q=c_style;
  380.               }
  381.               else
  382.               {   inventory_stage=1;
  383.                   parser_one=j; parser_two=depth; q=c_style;
  384.                   RunRoutines(j,list_together);
  385.               }
  386.               lt_value=j.list_together; listing_together=j;
  387.               WriteListR(j,depth+1,stack_pointer);
  388.               lt_value=0; listing_together=0;
  389.               l=0; if (c_style & NEWLINE_BIT == 0 && q & NEWLINE_BIT ~= 0) l=1;
  390.               c_style=q;
  391.               if (k==3)
  392.               {   if (c_style & ENGLISH_BIT ~= 0) print ")";
  393.               }
  394.               else
  395.               {   inventory_stage=2;
  396.                   parser_one=j; parser_two=depth;
  397.                   RunRoutines(j,list_together);
  398.               }
  399.               if (l==1) new_line;
  400.               mr=j.list_together;
  401.               jump Omit_EL;
  402.           }
  403.       }
  404.      .Omit_WL;
  405.       WriteBeforeEntry(j,depth);
  406.       if (c_style & NOARTICLE_BIT ~= 0) PrintShortName(j);
  407.       else
  408.       {   if (c_style & DEFART_BIT ~= 0) DefArt(j); else InDefArt(j);
  409.       }
  410.       WriteAfterEntry(j,depth,stack_pointer);
  411.  
  412.      .Omit_EL;
  413.       if (c_style & ENGLISH_BIT ~= 0)
  414.       {   if (i==senc-1) print " and ";
  415.           if (i<senc-1) print ", ";
  416.       }
  417.      .Omit_FL;
  418.   }
  419. ];
  420.  
  421. [ WriteBeforeEntry o depth  flag;
  422.   if (c_style & INDENT_BIT ~= 0) spaces 2*depth;
  423.  
  424.   if (c_style & FULLINV_BIT ~= 0)
  425.   {   if (o.invent~=0)
  426.       {   inventory_stage=1;
  427.           flag=PrintOrRun(o,invent,1);
  428.       }
  429.   }
  430.   return flag;
  431. ];
  432.  
  433. [ WriteAfterEntry o depth stack_p  flag flag2 flag3 p comb;
  434.  
  435.   if (c_style & PARTINV_BIT ~= 0)
  436.   {   comb=0;
  437.       if (o has light && location hasnt light) comb=comb+1;
  438.       if (o has container && o hasnt open)     comb=comb+2;
  439.       if ((o has container && (o has open || o has transparent))
  440.           && (child(o)==0)) comb=comb+4;
  441.       if (comb==1) print " (providing light)";
  442.       if (comb==2) print " (which is closed)";
  443.       if (comb==3) print " (closed and providing light)";
  444.       if (comb==4) print " (which is empty)";
  445.       if (comb==5) print " (empty and providing light)";
  446.       if (comb==6) print " (which is closed and empty)";
  447.       if (comb==7) print " (closed, empty and providing light)";
  448.   }
  449.  
  450.   if (c_style & FULLINV_BIT ~= 0)
  451.   {   if (o.invent ~= 0)
  452.       {   inventory_stage=2;
  453.           if (RunRoutines(o,invent)~=0)
  454.           {   if (c_style & NEWLINE_BIT ~= 0) new_line;
  455.               rtrue;
  456.           }
  457.       }
  458.       if (o has light && o has worn)
  459.       {   print " (providing light and being worn"; flag2=1; }
  460.       else
  461.       {   if (o has light) { print " (providing light"; flag2=1; }
  462.           if (o has worn)  { print " (being worn"; flag2=1; }
  463.       }
  464.       if (o has container)
  465.       {   if (o has openable)
  466.           {   if (flag2==1) print " and ";
  467.               else print " (which is ";
  468.               if (o has open)
  469.               {   print "open";
  470.                   if (child(o)==0) print " but empty";
  471.               }
  472.               else print "closed";
  473.               if (o has lockable && o has locked) print " and locked";
  474.               flag2=1;
  475.           }
  476.           else
  477.               if (child(o)==0)
  478.               {   if (flag2==1) print " and empty";
  479.                   else print " (which is empty)";
  480.               }
  481.       }
  482.       if (flag2==1) print ")";
  483.   }
  484.  
  485.   if (c_style & CONCEAL_BIT == 0)
  486.   {   if (child(o)~=0) flag3=children(o);
  487.   }
  488.   else
  489.   {   objectloop (p in o)
  490.           if (p hasnt concealed) flag3++;
  491.   }
  492.  
  493.   if (c_style & ALWAYS_BIT ~= 0 && flag3>0)
  494.   {   if (c_style & ENGLISH_BIT ~= 0) print " containing ";
  495.       flag=1;
  496.   }
  497.  
  498.   if (c_style & RECURSE_BIT ~= 1 && flag3>0)
  499.   {   if (o has supporter)
  500.       {   if (c_style & ENGLISH_BIT ~= 0)
  501.           {   if (c_style & TERSE_BIT ~= 0)
  502.               print " (on "; else print ", on top of ";
  503.               if (o has animate) print "whom "; else print "which ";
  504.           }
  505.           flag=1;
  506.       }
  507.       if (o has container && (o has open || o has transparent))
  508.       {   if (c_style & ENGLISH_BIT ~= 0)
  509.           {   if (c_style & TERSE_BIT ~= 0)
  510.                   print " (in "; else print ", inside ";
  511.               if (o has animate) print "whom "; else print "which ";
  512.           }
  513.           flag=1;
  514.       }
  515.   }
  516.  
  517.   if (flag==1 && c_style & ENGLISH_BIT ~= 0)
  518.   {   if (flag3 > 1) print "are "; else print "is ";
  519.   }
  520.  
  521.   if (c_style & NEWLINE_BIT ~= 0) new_line;
  522.  
  523.   if (flag==1) WriteListR(child(o),depth+1,stack_p);
  524.  
  525.   if (flag==1 && c_style & TERSE_BIT ~= 0) print ")";
  526. ];
  527.  
  528. ! ----------------------------------------------------------------------------
  529. !   A cunning routine (which could have been a daemon, but isn't, for the
  530. !   sake of efficiency) to move objects which could be in many rooms about
  531. !   so that the player never catches one not in place
  532. ! ----------------------------------------------------------------------------
  533.  
  534. [ MoveFloatingObjects i k l m address;
  535.   for (i=selfobj+1: i<=top_object: i++)
  536.   {   address=i.&found_in;
  537.       if (address~=0 && i hasnt absent)
  538.       {   if (ZRegion(address-->0)==2)
  539.           {   if (indirect(address-->0) ~= 0) move i to location;
  540.           }
  541.           else
  542.           {   k=i.#found_in;
  543.               for (l=0: l<k/2: l++)
  544.               {   m=address-->l;
  545.                   if (m==location || m in location) move i to location;
  546.               }
  547.           }
  548.       }
  549.   }
  550. ];
  551.  
  552. ! ----------------------------------------------------------------------------
  553. !   Two little routines for moving the player safely.
  554. ! ----------------------------------------------------------------------------
  555.  
  556. [ PlayerTo newplace flag;
  557.   move player to newplace;
  558.   while (parent(newplace)~=0) newplace=parent(newplace);
  559.   location=newplace;
  560.   real_location=location;
  561.   AdjustLight(1);
  562.   if (flag==0) <Look>;
  563.   if (flag==1) NoteArrival();
  564.   if (flag==2) LookSub(1);
  565. ];
  566.  
  567. [ MovePlayer direc; <Go direc>; <Look>; ];
  568.  
  569. ! ----------------------------------------------------------------------------
  570. !   The handy YesOrNo routine, and some "meta" verbs
  571. ! ----------------------------------------------------------------------------
  572.  
  573. [ YesOrNo i;
  574.   for (::)
  575.   {
  576.    #IFV3; read buffer parse; #ENDIF;
  577.    #IFV5; read buffer parse DrawStatusLine; #ENDIF;
  578.       i=parse-->1;
  579.       if (i=='yes' or #n$y) rtrue;
  580.       if (i=='no' or #n$n) rfalse;
  581.       L__M(##Quit,1); print "> ";
  582.   }
  583. ];
  584.  
  585. [ QuitSub; L__M(##Quit,2); if (YesOrNo()~=0) quit; ];
  586.  
  587. [ RestartSub; L__M(##Restart,1);
  588.   if (YesOrNo()~=0) { @restart; L__M(##Restart,2); }
  589. ];
  590.  
  591. [ RestoreSub;
  592.   restore Rmaybe;
  593.   return L__M(##Restore,1);
  594.   .RMaybe; L__M(##Restore,2);
  595. ];
  596.  
  597. [ SaveSub;
  598.   save Smaybe;
  599.   return L__M(##Save,1);
  600.   .SMaybe; L__M(##Save,2);
  601. ];
  602.  
  603. [ VerifySub;
  604.   @verify Vmaybe;
  605.   jump Vwrong;
  606.   .Vmaybe; return L__M(##Verify,1);
  607.   .Vwrong;
  608.   L__M(##Verify,2);
  609. ];
  610.  
  611. [ ScriptOnSub;
  612.   if (transcript_mode==1) return L__M(##ScriptOn,1);
  613.   transcript_mode=1;
  614.   0-->8 = (0-->8)|1;
  615.   L__M(##ScriptOn,2); VersionSub();
  616. ];
  617.  
  618. [ ScriptOffSub;
  619.   if (transcript_mode==0) return L__M(##ScriptOff,1);
  620.   L__M(##ScriptOff,2);
  621.   transcript_mode=0;
  622.   0-->8 = (0-->8)&$fffe;
  623. ];
  624.  
  625. [ NotifyOnSub; notify_mode=1; L__M(##NotifyOn); ];
  626. [ NotifyOffSub; notify_mode=0; L__M(##NotifyOff); ];
  627.  
  628. #IFNDEF NO_PLACES;
  629. [ PlacesSub i j k;
  630.   L__M(##Places);
  631.   for (i=selfobj:i<=top_object:i++)
  632.       if (i has visited) j++;
  633.  
  634.   for (i=selfobj:i<=top_object:i++)
  635.   {   if (i has visited)
  636.       {   PrintShortName(i); k++;
  637.           if (k==j) ".";
  638.           if (k==j-1) print " and "; else print ", ";
  639.       }
  640.   }
  641. ];
  642. [ ObjectsSub i j f;
  643.   L__M(##Objects,1);
  644.   for (i=selfobj:i<=top_object:i++)
  645.   {   if (i has moved)
  646.       {   f=1; DefArt(i); j=parent(i);
  647.           if (j==player)
  648.           {   if (i has worn) print "   (worn)";
  649.               else print "   (held)";
  650.               jump obj__ptd;
  651.           }
  652.           if (j has animate) { print "   (given away)"; jump obj__ptd; }
  653.           if (j has visited) { print "   (in "; PrintShortName(j);
  654.                                print ")"; jump obj__ptd; }
  655.           if (j has enterable) { print "   (in "; DefArt(j); print ")";
  656.                                  jump obj__ptd; }
  657.           if (j has container) { print "   (inside "; PrintShortName(j);
  658.                                  print ")"; jump obj__ptd; }
  659.           if (j has supporter) { print "   (on "; PrintShortName(j);
  660.                                  print ")"; jump obj__ptd; }
  661.           print "   (lost)";
  662.           .obj__ptd; new_line;
  663.       }
  664.   }
  665.   if (f==0) L__M(##Objects,2);
  666. ];
  667. #ENDIF;
  668.  
  669. ! ----------------------------------------------------------------------------
  670. !   The scoring system
  671. ! ----------------------------------------------------------------------------
  672.  
  673. #IFNDEF task_scores; Constant MAKE__TS; #ENDIF;
  674. #IFDEF MAKE__TS;
  675. Global task_scores initial 0;
  676. #ENDIF;
  677.  
  678. [ ScoreSub;
  679.   L__M(##Score);
  680.   PrintRank();
  681. ];
  682.  
  683. Global task_done data NUMBER_TASKS;
  684.  
  685. [ Achieved num;
  686.   if (task_done->num==0)
  687.   {   task_done->num=1; score=score+task_scores->num;
  688.   }
  689. ];
  690.  
  691. [ PANum m n;
  692.   print "  ";
  693.   n=m;
  694.   if (n<0)    { n=-m; n=n*10; }
  695.   if (n<10)   { print "   "; jump panuml; }
  696.   if (n<100)  { print "  "; jump panuml; }
  697.   if (n<1000) { print " "; }
  698. .panuml;
  699.   print m, " ";
  700. ];
  701.  
  702. [ FullScoreSub i;
  703.   ScoreSub();
  704.   if (score==0 || TASKS_PROVIDED==1) rfalse;
  705.   new_line;
  706.   L__M(##FullScore,1);
  707.  
  708.   for (i=0:i<NUMBER_TASKS:i++)
  709.       if (task_done->i==1)
  710.       {   PANum(task_scores->i);
  711.           PrintTaskName(i);
  712.       }
  713.   
  714.   if (things_score~=0)
  715.   {   PANum(things_score); L__M(##FullScore,2); }
  716.   if (places_score~=0)
  717.   {   PANum(places_score); L__M(##FullScore,3); }
  718.   new_line; PANum(score); L__M(##FullScore,4);
  719. ];
  720.  
  721. ! ----------------------------------------------------------------------------
  722. !   Real verbs start here: Inventory
  723. ! ----------------------------------------------------------------------------
  724.  
  725. global inventory_style;
  726.  
  727. [ InvWideSub;
  728.   inventory_style = FULLINV_BIT + ENGLISH_BIT + RECURSE_BIT;
  729.   <Inv>;
  730. ];
  731.  
  732. [ InvTallSub;
  733.   inventory_style = FULLINV_BIT + INDENT_BIT + NEWLINE_BIT + RECURSE_BIT;
  734.   <Inv>;
  735. ];
  736.  
  737. [ InvSub;
  738.   if (child(player)==0) return L__M(##Inv,1);
  739.   if (inventory_style==0) <<InvTall>>;
  740.  
  741.   L__M(##Inv,2);
  742.   if (inventory_style & NEWLINE_BIT ~= 0) print ":^"; else print " ";
  743.  
  744.   WriteListFrom(child(player), inventory_style, 1);
  745.   if (inventory_style & ENGLISH_BIT ~= 0) print ".^";
  746.  
  747.   AfterRoutines();
  748. ];
  749.  
  750. ! ----------------------------------------------------------------------------
  751. !   Object movement verbs
  752. ! ----------------------------------------------------------------------------
  753.  
  754. global keep_silent = 0;
  755.  
  756. [ TakeSub;
  757.   if (onotheld_mode==0 || parent(noun)~=player)
  758.   {   if (location==thedark)
  759.       {   if (RTakeSub(real_location)~=0) rtrue;
  760.       }
  761.       else
  762.       {   if (RTakeSub(location)~=0) rtrue;
  763.       }
  764.   }
  765.   if (AfterRoutines()==1) rtrue;
  766.   notheld_mode=onotheld_mode;
  767.   if (notheld_mode==1 || keep_silent==1) rtrue;
  768.   L__M(##Take,1);
  769. ];
  770.  
  771. [ RTakeSub fromobj i j k postonobj;
  772.   if (noun==player) return L__M(##Take,2);
  773.  
  774.   if (noun has animate) return L__M(##Take,3,noun);
  775.  
  776.   if (parent(player)==noun) return L__M(##Take,4,noun);
  777.  
  778.   i=parent(noun);
  779.   if (i==player) return L__M(##Take,5);
  780.  
  781.   if (i has container || i has supporter)
  782.   {   postonobj=i;
  783.       k=action; action=##LetGo;
  784.       if (RunRoutines(i,before)~=0) { action=k; rtrue; }
  785.       action=k;
  786.   }
  787.  
  788.   while (i~=fromobj && i~=0)
  789.   {   if (i hasnt container && i hasnt supporter)
  790.       {   if (i has animate) return L__M(##Take,6,i);
  791.           if (i has transparent) return L__M(##Take,7,i);
  792.           return L__M(##Take,8);
  793.       }
  794.       if (i has container && i hasnt open)
  795.           return L__M(##Take,9,i);
  796.       i=parent(i);
  797.       if (i==player) i=fromobj;
  798.   }
  799.   if (noun has scenery) return L__M(##Take,10);
  800.   if (noun has static)  return L__M(##Take,11);
  801.  
  802.   k=0; objectloop (j in player) if (j hasnt worn) k++;
  803.  
  804.   if (k >= ValueOrRun(player,capacity))
  805.   {   if (SACK_OBJECT~=0)
  806.       {   if (parent(SACK_OBJECT)~=player)
  807.               return L__M(##Take,12);
  808.           j=0;
  809.           objectloop (k in player) 
  810.               if (k~=SACK_OBJECT && k hasnt worn && k hasnt light) j=k;
  811.  
  812.           if (j~=0)
  813.           {   L__M(##Take,13,j);
  814.               keep_silent = 1; <Insert j SACK_OBJECT>; keep_silent = 0;
  815.               if (j notin SACK_OBJECT) rtrue;
  816.           }
  817.           else return L__M(##Take,12);
  818.       }
  819.       else return L__M(##Take,12);
  820.   }
  821.   move noun to player;
  822.  
  823.   if (postonobj~=0)
  824.   {   k=action; action=##LetGo;
  825.       if (RunRoutines(postonobj,after)~=0) { action=k; rtrue; }
  826.       action=k;
  827.   }
  828.   rfalse;
  829. ];
  830.  
  831. [ DropSub i;
  832.   i=parent(noun);
  833.   if (i==location) return L__M(##Drop,1);
  834.   if (i~=player) return L__M(##Drop,2);
  835.   if (noun has worn)
  836.   {   L__M(##Drop,3,noun);
  837.       <Disrobe noun>;
  838.       if (noun has worn) rtrue;
  839.   }
  840.   move noun to parent(player);
  841.   if (AfterRoutines()==1) rtrue;
  842.   if (keep_silent==1) rtrue;
  843.   return L__M(##Drop,4);
  844. ];
  845.  
  846. [ RemoveSub i;
  847.  
  848.   i=parent(noun);
  849.   if (i has container && i hasnt open) return L__M(##Remove,1);
  850.   if (i~=second) return L__M(##Remove,2);
  851.   if (RTakeSub(second)~=0) rtrue;
  852.   action=##Take;   if (AfterRoutines()==1) rtrue;
  853.   action=##Remove; if (AfterRoutines()==1) rtrue;
  854.  
  855.   if (keep_silent==1) rtrue;
  856.   return L__M(##Remove,4);
  857. ];
  858.  
  859. [ IndirectlyContains o1 o2;  ! Does o1 already (ultimately) have o2?
  860.   while (o2~=0)
  861.   {   if (o1==o2) rtrue;
  862.       o2=parent(o2);
  863.   }
  864.   rfalse;
  865. ];
  866.  
  867. global receive_action = 0;
  868.  
  869. [ PutOnSub;
  870.   receive_action=##PutOn; 
  871.   if (second==d_obj) { <Drop noun>; rfalse; }
  872.   if (parent(noun)~=player) return L__M(##PutOn,1,noun);
  873.  
  874.   if (second>1)
  875.   {   action=##Receive;
  876.       if (RunRoutines(second,before)~=0) { action=##PutOn; rtrue; }
  877.       action=##PutOn;
  878.   }
  879.  
  880.   if (IndirectlyContains(noun,second)==1) return L__M(##PutOn,2);
  881.   if (second hasnt supporter) return L__M(##PutOn,3,second);
  882.   if (parent(second)==player) return L__M(##PutOn,4);
  883.   if (noun has worn)
  884.   {   L__M(##PutOn,5);
  885.       <Disrobe noun>;
  886.       if (noun has worn) rtrue;
  887.   }
  888.   if (children(second)>=ValueOrRun(second,capacity)) return L__M(##PutOn,6);
  889.   move noun to second;
  890.  
  891.   if (AfterRoutines()==1) rtrue;
  892.  
  893.   if (second>1)
  894.   {   action=##Receive;
  895.       if (RunRoutines(second,after)~=0) { action=##PutOn; rtrue; }
  896.       action=##PutOn;
  897.   }
  898.  
  899.   if (keep_silent==1) rtrue;
  900.   if (multiflag==1) return L__M(##PutOn,7);
  901.   L__M(##PutOn,8,noun);
  902. ];
  903.  
  904. [ InsertSub;
  905.   receive_action = ##Insert;
  906.   if (second==d_obj ) <<Drop noun>>;
  907.   if (parent(noun)~=player) return L__M(##Insert,1);
  908.  
  909.   if (second>1)
  910.   {   action=##Receive;
  911.       if (RunRoutines(second,before)~=0) { action=##Insert; rtrue; }
  912.       action=##Insert;
  913.   }
  914.   if (second hasnt container) return L__M(##Insert,2);
  915.   if (second hasnt open)      return L__M(##Insert,3);
  916.   if (IndirectlyContains(noun,second)==1) return L__M(##Insert,5);
  917.   if (noun has worn)
  918.   {   L__M(##Insert,6);
  919.       <Disrobe noun>; if (noun has worn) rtrue;
  920.   }
  921.  
  922.   if (children(second)>=ValueOrRun(second,capacity))
  923.       return L__M(##Insert,7,second);
  924.  
  925.   move noun to second;
  926.  
  927.   if (AfterRoutines()==1) rtrue;
  928.  
  929.   if (second>1)
  930.   {   action=##Receive;
  931.       if (RunRoutines(second,after)~=0) { action=##Insert; rtrue; }
  932.       action=##Insert;
  933.   }
  934.   if (keep_silent==1) rtrue;
  935.   if (multiflag==1) return L__M(##Insert,8);
  936.   L__M(##Insert,9,noun);
  937. ];
  938.  
  939. [ TransferSub i act_needed k postonobj par;
  940.   act_needed=##Drop;
  941.   if (second has container) act_needed=##Insert;
  942.   else
  943.       if (second has supporter) act_needed=##PutOn;
  944.  
  945.   i=parent(noun);
  946.   if (i~=player)
  947.   {   while (i~=0)
  948.       {   if (i hasnt open) return L__M(##Transfer,1);
  949.           i=parent(i);
  950.           if (i==player) jump DoTransfer;
  951.       }
  952.       return L__M(##Transfer,2);
  953.   }
  954.   .DoTransfer;
  955.   if (noun notin player)
  956.   {   par = parent(noun);
  957.       if (par has container || par has supporter)
  958.       {   postonobj=par;
  959.           k=action; action=##LetGo;
  960.           if (RunRoutines(par,before)~=0) { action=k; rtrue; }
  961.           action=k;
  962.       }
  963.       move noun to player;
  964.       if (postonobj~=0)
  965.       {   k=action; action=##LetGo;
  966.           if (RunRoutines(postonobj,after)~=0) { action=k; rtrue; }
  967.           action=k;
  968.       }
  969.   }
  970.   if (act_needed==##Drop)   <<Drop noun>>;
  971.   if (act_needed==##Insert) <<Insert noun second>>;
  972.   if (act_needed==##PutOn)  <<PutOn noun second>>;
  973.  
  974. ];
  975.  
  976. [ EmptySub;
  977.   second=d_obj; EmptyTSub();
  978. ];
  979.  
  980. [ EmptyTSub i j;
  981.   if (noun hasnt container) return L__M(##EmptyT,1,noun);
  982.   if (noun hasnt open) return L__M(##EmptyT,2,noun);
  983.   if (second~=d_obj)
  984.   {   if (second hasnt container) return L__M(##EmptyT,1,second);
  985.       if (second hasnt open) return L__M(##EmptyT,2,second);
  986.   }
  987.   i=child(noun);
  988.   if (i==0) return L__M(##EmptyT,3,noun);
  989.   while (i~=0)
  990.   {   j=sibling(i);
  991.       PrintShortName(i); print ": ";
  992.       <Transfer i second>;
  993.       i=j;
  994.   }
  995. ];
  996.  
  997. [ GiveSub;
  998.   if (parent(noun)~=player) return L__M(##Give,1,noun);
  999.   if (second==player)  return L__M(##Give,2,noun);
  1000.   if (RunLife(second,##Give)~=0) rfalse;
  1001.   L__M(##Give,3,second);
  1002. ];
  1003.  
  1004. [ GiveRSub; <Give second noun>; ];
  1005.  
  1006. [ ShowSub;
  1007.   if (parent(noun)~=player) return L__M(##Show,1,noun);
  1008.   if (second==player) <<Examine noun>>;
  1009.   if (RunLife(second,##Show)~=0) rfalse;
  1010.   L__M(##Show,2,second);
  1011. ];
  1012.  
  1013. [ ShowRSub; <Show second noun>; ];
  1014.  
  1015. ! ----------------------------------------------------------------------------
  1016. !   Travelling around verbs
  1017. ! ----------------------------------------------------------------------------
  1018.  
  1019. [ EnterSub i;
  1020.   if (noun has door) <<Go noun>>;
  1021.   i=parent(player);
  1022.   if (i~=location) return L__M(##Enter,1,i);
  1023.   i=parent(noun);
  1024.   if (i==compass) <<Go noun>>;
  1025.   if (noun hasnt enterable) return L__M(##Enter,2);
  1026.   if (noun has container && noun hasnt open) return L__M(##Enter,3,noun);
  1027.   if (i~=location)  return L__M(##Enter,4);
  1028.   move player to noun;
  1029.   if (AfterRoutines()==1) rtrue;
  1030.   if (keep_silent==1) rtrue;
  1031.   L__M(##Enter,5,noun);
  1032.   Locale(noun);
  1033. ];
  1034.  
  1035. [ GetOffSub;
  1036.   if (parent(player)==noun) <<Exit>>;
  1037.   L__M(##GetOff,1,noun);
  1038. ];
  1039.  
  1040. [ ExitSub p;
  1041.   p=parent(player);
  1042.   if (p==location || (location==thedark && p==real_location))
  1043.   {   if ((location.out_to~=0)
  1044.           || (location==thedark && real_location.out_to~=0)) <<Go out_obj>>;
  1045.       return L__M(##Exit,1);
  1046.   }
  1047.   if (p has container && p hasnt open)
  1048.       return L__M(##Exit,2,p);
  1049.   if (location == thedark) move player to real_location;
  1050.   else move player to location;
  1051.   if (LAfterRoutines()==1) rtrue;
  1052.   if (keep_silent==1) rtrue;
  1053.   L__M(##Exit,3); LookSub(1);
  1054. ];
  1055.  
  1056. [ VagueGoSub; L__M(##VagueGo); ];
  1057.  
  1058. [ GoInSub;
  1059.   <<Go in_obj>>;
  1060. ];
  1061.  
  1062. [ GoSub i j k df movewith thedir;
  1063.  
  1064.   movewith=0;
  1065.   i=parent(player);
  1066.   if ((location~=thedark && i~=location)
  1067.       || (location==thedark && i~=real_location))
  1068.   {   j=location;
  1069.       if (location==thedark) location=real_location;
  1070.       k=RunRoutines(i,before); if (k~=3) location=j;
  1071.       if (k==1)
  1072.       {   movewith=i; i=parent(i); jump gotroom; }
  1073.       if (k==0) L__M(##Go,1,i); rtrue;
  1074.   }
  1075.   .gotroom;
  1076.   thedir=noun.door_dir;
  1077.   if (ZRegion(thedir)==2) thedir=RunRoutines(noun,door_dir);
  1078.   
  1079.   j=i.thedir; k=ZRegion(j);
  1080.   if (k==3) { print_paddr j; new_line; rfalse; }
  1081.   if (k==2) { j=RunRoutines(i,thedir);
  1082.               if (j==1) rtrue;
  1083.             }
  1084.  
  1085.   if (k==0 || j==0)
  1086.   {   if (i.cant_go ~= 0) PrintOrRun(i, cant_go);
  1087.       rfalse;
  1088.   }
  1089.  
  1090.   if (j has door)
  1091.   {   if (j has concealed) return L__M(##Go,2);
  1092.       if (j hasnt open)
  1093.       {   if (noun==u_obj) return L__M(##Go,3,j);
  1094.           if (noun==d_obj) return L__M(##Go,4,j);
  1095.           return L__M(##Go,5,j);
  1096.       }
  1097.       if (ZRegion(j.door_to)==2) j=RunRoutines(j,door_to);
  1098.       else j=j.door_to;
  1099.       if (j==0) return L__M(##Go,6,j);
  1100.   }
  1101.   if (movewith==0) move player to j; else move movewith to j;
  1102.  
  1103.   df=OffersLight(j);
  1104.   if (df~=0) { location=j; lightflag=1; }
  1105.   else
  1106.   {   if (location==thedark) DarkToDark();
  1107.       real_location=j;
  1108.       location=thedark; lightflag=0;
  1109.   }
  1110.   if (LAfterRoutines()==1) rtrue;
  1111.   if (keep_silent==1) rtrue;
  1112.   LookSub(1);
  1113. ];
  1114.  
  1115. ! ----------------------------------------------------------------------------
  1116. !   Describing the world.  SayWhatsOn(object) does just that (producing
  1117. !   no text if nothing except possibly "scenery" and "concealed" items are).
  1118. !   Locale(object) runs through the "tail end" of a Look-style room
  1119. !   description for the contents of the object, printing up suitable
  1120. !   descriptions as it goes.
  1121. ! ----------------------------------------------------------------------------
  1122.  
  1123. [ SayWhatsOn descon j f;
  1124.   if (descon==parent(player)) rfalse;
  1125.   objectloop (j in descon)
  1126.       if (j hasnt concealed && j hasnt scenery) f=1;
  1127.   if (f==0) rfalse;
  1128.   L__M(##Look, 4, descon); rtrue;
  1129. ];
  1130.  
  1131. [ Locale descin   o p k j flag f2;
  1132.  
  1133.   objectloop (o in descin) give o ~workflag;
  1134.  
  1135.   k=0;
  1136.   objectloop (o in descin)
  1137.       if (o hasnt concealed && o~=parent(player))
  1138.       {  if (o hasnt scenery)
  1139.          {   give o workflag; k++;
  1140.              p=initial; f2=0;
  1141.              if (o has door && o hasnt open) { p=when_closed; f2=1; }
  1142.              if (o has switchable && o hasnt on) { p=when_off; f2=1; }
  1143.              if (o has container && o hasnt open && o.&when_closed~=0)
  1144.              {   p=when_closed; f2=1; }
  1145.              if (o hasnt moved || o.describe~=NULL || f2==1)
  1146.              {   if (o.describe~=NULL && RunRoutines(o,describe)~=0)
  1147.                  {   flag=1;
  1148.                      give o ~workflag; k--;
  1149.                  }    
  1150.                  else
  1151.                  {   j=o.p;
  1152.                      if (j~=0)
  1153.                      {   new_line;
  1154.                          PrintOrRun(o,p);
  1155.                          flag=1;
  1156.                          give o ~workflag; k--;
  1157.                          if (o has supporter && child(o)~=0) SayWhatsOn(o);
  1158.                      }
  1159.                  }
  1160.              }
  1161.          }
  1162.          else
  1163.              if (o has supporter && child(o)~=0) SayWhatsOn(o);
  1164.       }
  1165.  
  1166.   if (k==0) return;
  1167.   if (flag==1) L__M(##Look,5,descin); else L__M(##Look,6,descin);
  1168.  
  1169. ];
  1170.  
  1171. ! ----------------------------------------------------------------------------
  1172. !   Looking.  LookSub(1) is allowed to abbreviate long descriptions, but
  1173. !     LookSub(0) (which is what happens when the Look action is generated)
  1174. !     isn't.  (Except that these are over-ridden by the player-set lookmode.)
  1175. ! ----------------------------------------------------------------------------
  1176.  
  1177. [ LMode1Sub; lookmode=1; print_paddr #Story; L__M(##LMode1); ];  ! Brief
  1178.  
  1179. [ LMode2Sub; lookmode=2; print_paddr #Story; L__M(##LMode2); ];  ! Verbose
  1180.  
  1181. [ LMode3Sub; lookmode=3; print_paddr #Story; L__M(##LMode3); ];  ! Superbrief
  1182.  
  1183. [ NoteArrival descin;
  1184.   descin=location;
  1185.   if (descin~=lastdesc)
  1186.   {   if (descin.initial~=0) PrintOrRun(descin, initial);
  1187.       NewRoom();
  1188.       MoveFloatingObjects();
  1189.       lastdesc=descin;
  1190.   }
  1191. ];
  1192.  
  1193. [ LookSub allow_abbrev  i descin;
  1194.   if (parent(player)==0) "** Error: player has no location **";
  1195.   NoteArrival();
  1196.   new_line;
  1197. #IFV5; style bold; #ENDIF;
  1198.   PrintShortName(location);
  1199. #IFV5; style roman; #ENDIF;
  1200.  
  1201.   i=parent(player);
  1202.   if (location~=thedark && i~=location)
  1203.   {   if (i has supporter) { print " ("; L__M(##Look,1); print " "; }
  1204.       else { print " ("; L__M(##Look,2); print " "; }
  1205.       DefArt(i); print ")"; descin=i;
  1206.   }
  1207.   if (print_player_flag==1) { print " ("; L__M(##Look,3);
  1208.       print " "; print object player, ")"; }
  1209.   new_line;
  1210.  
  1211.   if (lookmode<3)
  1212.   {   if ((allow_abbrev~=1) || (lookmode==2) || (location hasnt visited))
  1213.       {   if (location.describe~=NULL) RunRoutines(location,describe);
  1214.           else
  1215.           {   if (location.description==0) print "** Room undescribed! **^";
  1216.               else PrintOrRun(location,description);
  1217.           }
  1218.       }
  1219.   }
  1220.  
  1221.   if (location hasnt visited)
  1222.   {   give location visited;
  1223.       if (location has scored)
  1224.       {   score=score+ROOM_SCORE;
  1225.           places_score=places_score+ROOM_SCORE;
  1226.       }
  1227.   }
  1228.  
  1229.   if (descin~=location) Locale(location);
  1230.   Locale(descin);
  1231.  
  1232.   LookRoutine();
  1233.   action=##Look;
  1234.   if (LAfterRoutines()==1) rtrue;
  1235. ];
  1236.  
  1237. [ ExamineSub i;
  1238.   if (location==thedark) return L__M(##Examine,1);
  1239.   i=noun.description;
  1240.   if (i==0)
  1241.   {   if (noun has container) <<Search noun>>;
  1242.       if (noun has switchable) { L__M(##Examine,3,noun); rfalse; }
  1243.       return L__M(##Examine,2,noun);
  1244.   }
  1245.   PrintOrRun(noun, description);
  1246.   if (noun has switchable) L__M(##Examine,3,noun);
  1247.   if (AfterRoutines()==1) rtrue;
  1248. ];
  1249.  
  1250. [ LookUnderSub;
  1251.   if (location==thedark) return L__M(##LookUnder,1);
  1252.   L__M(##LookUnder,2);
  1253. ];
  1254.  
  1255. [ SearchSub i f;
  1256.   if (location==thedark) return L__M(##Search,1);
  1257.   objectloop (i in noun) if (i hasnt concealed) f=1;
  1258.   if (noun has supporter)
  1259.   {   if (f==0) return L__M(##Search,2,noun);
  1260.       return L__M(##Search,3,noun);
  1261.   }
  1262.   if (noun hasnt container) return L__M(##Search,4);
  1263.   if (noun hasnt transparent && noun hasnt open)
  1264.       return L__M(##Search,5);
  1265.   if (AfterRoutines()==1) rtrue;
  1266.  
  1267.   i=children(noun);
  1268.   if (f==0) return L__M(##Search,6,noun);
  1269.   L__M(##Search,7,noun);
  1270. ];
  1271.  
  1272. ! ----------------------------------------------------------------------------
  1273. !   Verbs which change the state of objects without moving them
  1274. ! ----------------------------------------------------------------------------
  1275.  
  1276. [ UnlockSub;
  1277.   if (noun hasnt lockable) return L__M(##Unlock,1);
  1278.   if (noun hasnt locked)   return L__M(##Unlock,2);
  1279.   if (noun.with_key~=second) return L__M(##Unlock,3);
  1280.   give noun ~locked;
  1281.   if (AfterRoutines()==1) rtrue;
  1282.   if (keep_silent==1) rtrue;
  1283.   L__M(##Unlock,4,noun);
  1284. ];
  1285.  
  1286. [ LockSub;
  1287.   if (noun hasnt lockable) return L__M(##Lock,1);
  1288.   if (noun has locked)     return L__M(##Lock,2);
  1289.   if (noun has open)       return L__M(##Lock,3);
  1290.   if (noun.with_key~=second) return L__M(##Lock,4);
  1291.   give noun locked;
  1292.   if (AfterRoutines()==1) rtrue;
  1293.   if (keep_silent==1) rtrue;
  1294.   L__M(##Lock,5,noun);
  1295. ];
  1296.  
  1297. [ SwitchonSub;
  1298.   if (noun hasnt switchable) return L__M(##SwitchOn,1);
  1299.   if (noun has on) return L__M(##SwitchOn,2);
  1300.   give noun on;
  1301.   if (AfterRoutines()==1) rtrue;
  1302.   if (keep_silent==1) rtrue;
  1303.   L__M(##SwitchOn,3,noun);
  1304. ];
  1305.  
  1306. [ SwitchoffSub;
  1307.   if (noun hasnt switchable) return L__M(##SwitchOff,1);
  1308.   if (noun hasnt on) return L__M(##SwitchOff,2);
  1309.   give noun ~on;
  1310.   if (AfterRoutines()==1) rtrue;
  1311.   if (keep_silent==1) rtrue;
  1312.   L__M(##SwitchOff,3,noun);
  1313. ];
  1314.  
  1315. [ OpenSub;
  1316.   if (noun hasnt openable) return L__M(##Open,1);
  1317.   if (noun has locked)     return L__M(##Open,2);
  1318.   if (noun has open)       return L__M(##Open,3);
  1319.   give noun open;
  1320.   if (AfterRoutines()==1) rtrue;
  1321.   if (keep_silent==1) rtrue;
  1322.   if (noun has container && noun hasnt transparent && child(noun)~=0)
  1323.       return L__M(##Open,4,noun);
  1324.   L__M(##Open,5,noun);
  1325. ];
  1326.  
  1327. [ CloseSub;
  1328.   if (noun hasnt openable) return L__M(##Close,1);
  1329.   if (noun hasnt open)     return L__M(##Close,2);
  1330.   give noun ~open;
  1331.   if (AfterRoutines()==1) rtrue;
  1332.   if (keep_silent==1) rtrue;
  1333.   L__M(##Close,3,noun);
  1334. ];
  1335.  
  1336. [ DisrobeSub;
  1337.   if (noun hasnt worn) return L__M(##Disrobe,1);
  1338.   give noun ~worn;
  1339.   if (AfterRoutines()==1) rtrue;
  1340.   if (keep_silent==1) rtrue;
  1341.   L__M(##Disrobe,2,noun);
  1342. ];
  1343.  
  1344. [ WearSub;
  1345.   if (noun hasnt clothing)  return L__M(##Wear,1);
  1346.   if (parent(noun)~=player) return L__M(##Wear,2);
  1347.   if (noun has worn)        return L__M(##Wear,3);
  1348.   give noun worn;
  1349.   if (AfterRoutines()==1) rtrue;
  1350.   if (keep_silent==1) rtrue;
  1351.   L__M(##Wear,4,noun);
  1352. ];
  1353.  
  1354. [ EatSub;
  1355.   if (noun hasnt edible) return L__M(##Eat,1);
  1356.   remove noun;
  1357.   if (AfterRoutines()==1) rtrue;
  1358.   if (keep_silent==1) rtrue;
  1359.   L__M(##Eat,2,noun);
  1360. ];
  1361.  
  1362. ! ----------------------------------------------------------------------------
  1363. !   Verbs which are really just stubs (anything which happens for these
  1364. !   actions must happen in before rules)
  1365. ! ----------------------------------------------------------------------------
  1366.  
  1367. [ YesSub; L__M(##Yes); ];
  1368. [ NoSub; L__M(##No); ];
  1369. [ BurnSub; L__M(##Burn); ];
  1370. [ PraySub; L__M(##Pray); ];
  1371. [ WakeSub; L__M(##Wake); ];
  1372. [ WakeOtherSub;
  1373.   if (RunLife(noun,##WakeOther)~=0) rfalse;
  1374.   L__M(##WakeOther);
  1375. ];
  1376. [ ThinkSub; L__M(##Think); ];
  1377. [ SmellSub; L__M(##Smell); ];
  1378. [ ListenSub; L__M(##Listen); ];
  1379. [ TasteSub; L__M(##Taste); ];
  1380. [ DigSub; L__M(##Dig); ];
  1381. [ CutSub; L__M(##Cut); ];
  1382. [ JumpSub; L__M(##Jump); ];
  1383. [ JumpOverSub; L__M(##JumpOver); ];
  1384. [ TieSub; L__M(##Tie); ];
  1385. [ DrinkSub; L__M(##Drink); ];
  1386. [ FillSub; L__M(##Fill); ];
  1387. [ SorrySub; L__M(##Sorry); ];
  1388. [ StrongSub; L__M(##Strong); ];
  1389. [ MildSub; L__M(##Mild); ];
  1390. [ SwimSub; L__M(##Swim); ];
  1391. [ SwingSub; L__M(##Swing); ];
  1392. [ BlowSub; L__M(##Blow); ];
  1393. [ RubSub; L__M(##Rub); ];
  1394. [ SetSub; L__M(##Set); ];
  1395. [ SetToSub; L__M(##SetTo); ];
  1396. [ WaveHandsSub; L__M(##WaveHands); ];
  1397. [ BuySub; L__M(##Buy); ];
  1398. [ SingSub; L__M(##Sing); ];
  1399. [ ClimbSub; L__M(##Climb); ];
  1400. [ SleepSub; L__M(##Sleep); ];
  1401. [ ConsultSub; L__M(##Consult,1,noun); ];
  1402. [ TouchSub;
  1403.   if (noun==player) return L__M(##Touch,3);
  1404.   if (noun has animate) return L__M(##Touch,1);
  1405.   L__M(##Touch,2); ];
  1406. [ WaveSub;
  1407.   if (parent(noun)~=player) return L__M(##Wave,1);
  1408.   L__M(##Wave,2,noun); ];
  1409. [ PullSub;
  1410.   if (noun has static)   return L__M(##Pull,1);
  1411.   if (noun has scenery)  return L__M(##Pull,2);
  1412.   if (noun has animate)  return L__M(##Pull,4);
  1413.   L__M(##Pull,3);
  1414. ];
  1415. [ PushSub;
  1416.   if (noun has static)   return L__M(##Push,1);
  1417.   if (noun has scenery)  return L__M(##Push,2);
  1418.   if (noun has animate)  return L__M(##Pull,4);
  1419.   L__M(##Push,3);
  1420. ];
  1421. [ TurnSub;
  1422.   if (noun has static)   return L__M(##Turn,1);
  1423.   if (noun has scenery)  return L__M(##Turn,2);
  1424.   if (noun has animate)  return L__M(##Pull,4);
  1425.   L__M(##Turn,3);
  1426. ];
  1427.  
  1428. [ WaitSub;
  1429.   if (LAfterRoutines()==1) rtrue;
  1430.   L__M(##Wait);
  1431. ];
  1432.  
  1433. [ PushDirSub; L__M(##PushDir,1); ];
  1434. [ AllowPushDir i;
  1435.   if (parent(second)~=compass) return L__M(##PushDir,2);
  1436.   if (second==u_obj or d_obj)  return L__M(##PushDir,3);
  1437.   AfterRoutines();
  1438.   i=noun; <Go second>; move i to location;
  1439. ];
  1440.  
  1441. [ SqueezeSub;
  1442.   if (noun has animate) return L__M(##Squeeze,1);
  1443.   L__M(##Squeeze,2);
  1444. ];
  1445.  
  1446. [ ThrowAtSub;
  1447.   if (second>1)
  1448.   {   action=##ThrownAt;
  1449.       if (RunRoutines(second,before)~=0) { action=##ThrowAt; rtrue; }
  1450.       action=##ThrowAt;
  1451.   }
  1452.   if (second hasnt animate) return L__M(##ThrowAt,1);
  1453.   if (RunLife(second,##ThrowAt)~=0) rfalse;
  1454.   L__M(##ThrowAt,2);
  1455. ];
  1456.  
  1457. [ AttackSub;
  1458.   if (noun has animate && RunLife(noun,##Attack)~=0) rfalse;
  1459.   L__M(##Attack); ];
  1460.  
  1461. [ KissSub;
  1462.   if (RunLife(noun,##Kiss)~=0) rfalse;
  1463.   if (noun==player) return L__M(##Touch,3);
  1464.   L__M(##Kiss);
  1465. ];
  1466.  
  1467. [ AnswerSub;
  1468.   inp1=special_word; noun=inp1;
  1469.   if (RunLife(second,##Answer)~=0) rfalse;
  1470.   L__M(##Answer);
  1471. ];  
  1472.  
  1473. [ TellSub;
  1474.   inp2=special_word; second=inp2;
  1475.   if (noun==player) return L__M(##Tell);
  1476.   if (RunLife(noun,##Tell)~=0) rfalse;
  1477.   L__M(##Tell,2);
  1478. ];  
  1479.   
  1480. [ AskSub;
  1481.   inp2=special_word; second=inp2;
  1482.   if (RunLife(noun,##Ask)~=0) rfalse;
  1483.   L__M(##Ask);
  1484. ];  
  1485.  
  1486. [ AskForSub;
  1487.   action=##Give; inp1=second; inp2=player;
  1488.   if (RunLife(noun,##Order)~=0) rfalse;
  1489.   L__M(##Order);
  1490. ];  
  1491.  
  1492. ! ----------------------------------------------------------------------------
  1493. !   Debugging verbs
  1494. ! ----------------------------------------------------------------------------
  1495.  
  1496. #IFDEF DEBUG;
  1497. [ TraceOnSub; parser_trace=1; "[Trace on.]"; ];
  1498. [ TraceLevelSub; parser_trace=noun;
  1499.   print "[Parser tracing set to level ", parser_trace, ".]^"; ];
  1500. [ TraceOffSub; parser_trace=0; "Trace off."; ];
  1501. [ RoutinesOnSub;  debug_flag=debug_flag | 1; "[Routine listing on.]"; ];
  1502. [ RoutinesOffSub; debug_flag=debug_flag & 6; "[Routine listing off.]"; ];
  1503. [ ActionsOnSub;  debug_flag=debug_flag | 2; "[Action listing on.]"; ];
  1504. [ ActionsOffSub; debug_flag=debug_flag & 5; "[Action listing off.]"; ];
  1505. [ TimersOnSub;  debug_flag=debug_flag | 4; "[Timers listing on.]"; ];
  1506. [ TimersOffSub; debug_flag=debug_flag & 3; "[Timers listing off.]"; ];
  1507. global xcommsdir = 0;
  1508. [ CommandsOnSub;
  1509.   @output_stream 4; xcommsdir=1; "[Command recording on.]"; ];
  1510. [ CommandsOffSub;
  1511.   if (xcommsdir==1) @output_stream -4;
  1512.   xcommsdir=0;
  1513.   "[Command recording off.]"; ];
  1514. [ CommandsReadSub;
  1515.   @input_stream 1; xcommsdir=2; "[Replaying commands.]"; ];
  1516. [ PredictableSub i; i=random(-100);
  1517.   "[Random number generator now predictable.]"; ];
  1518. [ XPurloinSub; move noun to player; give noun moved ~concealed; "[Purloined.]"; ];
  1519. [ XAbstractSub; move noun to second; "[Abstracted.]"; ];
  1520. [ XObj obj f;
  1521.   if (parent(obj)==0) PrintShortName(obj); else InDefArt(obj);
  1522.   print " (", obj, ") ";
  1523.   if (f==1) { print "(in "; PrintShortName(parent(obj));
  1524.               print " ", parent(obj), ")"; }
  1525.   new_line;
  1526.   if (child(obj)==0) rtrue;
  1527.   WriteListFrom(child(obj),
  1528.       FULLINV_BIT + INDENT_BIT + NEWLINE_BIT + ALWAYS_BIT, 1);
  1529. ];
  1530. [ XTreeSub i;
  1531.   if (noun==0)
  1532.   {   for (i=selfobj+1:i<=top_object:i++)
  1533.       {   if (parent(i)==0) XObj(i);
  1534.       }
  1535.       rfalse;
  1536.   }
  1537.   XObj(noun,1);
  1538. ];
  1539. [ GotoSub;
  1540.   if (noun>top_object || noun<=selfobj || parent(noun)~=0)
  1541.       "[Not a safe place.]";
  1542.   PlayerTo(noun);
  1543. ];
  1544. [ GonearSub x; x=noun; while (parent(x)~=0) x=parent(x); PlayerTo(x); ];
  1545. #ENDIF;
  1546.  
  1547. ! ----------------------------------------------------------------------------
  1548. !   Finally: virtually all the text produced by library routines, except for
  1549. !   some parser errors (which are indirected through ParserError).
  1550. ! ----------------------------------------------------------------------------
  1551.  
  1552. [ L__M act n x1 s;
  1553.   s=sw__var; sw__var=act; if (n==0) n=1;
  1554.   L___M(n,x1);
  1555.   sw__var=s;
  1556. ];
  1557.  
  1558. [ L___M n x1 s;
  1559.   s=action;
  1560. #IFDEF LibraryMessages;
  1561.   lm_n=n; lm_o=x1;
  1562.   action=sw__var;
  1563.   if (RunRoutines(LibraryMessages,before)~=0) { action=s; rfalse; }
  1564.   action=s;
  1565. #ENDIF;
  1566.   Prompt:  print "^>"; rtrue;
  1567.   Miscellany: if (n==1) "(considering the first sixteen objects only)^";
  1568.            if (n==2) "Nothing to do!";
  1569.            if (n==3) { print " You have died "; rtrue; }
  1570.            if (n==4) { print " You have won "; rtrue; }
  1571.            if (n==5)
  1572.            {   print "^Would you like to RESTART, RESTORE a saved game";
  1573.                if (TASKS_PROVIDED==0)
  1574.                    print ", give the FULL score for that game";
  1575.                if (deadflag==2 && AMUSING_PROVIDED==0)
  1576.                    print ", see some suggestions for AMUSING things to do";
  1577.                " or QUIT?"; }
  1578.            if (n==6) "[Your interpreter does not provide ~undo~.  Sorry!]";
  1579.            if (n==7) "~Undo~ failed.  [Not all interpreters provide it.]";
  1580.            if (n==8) "Please give one of the answers above.";
  1581.            if (n==9) "^It is now pitch dark in here!";
  1582.   Order:   CDefArt(actor); " has better things to do.";
  1583.   Quit:    if (n==1) { print "Please answer yes or no."; rtrue; }
  1584.            print "Are you sure you want to quit? "; rtrue;
  1585.   Restart: if (n==1) { print "Are you sure you want to restart? "; rtrue; }
  1586.            "Failed.";
  1587.   Restore: if (n==1) "Restore failed.";
  1588.            "Ok.";
  1589.   Save:    if (n==1) "Save failed.";
  1590.            "Ok.";
  1591.   Verify:  if (n==1) "The game file has verified as intact.";
  1592.            "The game file did not verify properly, and may be corrupted \
  1593.            (or you may be running it on a very primitive interpreter which \
  1594.            is unable properly to perform the test).";
  1595.   ScriptOn: if (n==1) "Transcripting is already on.";
  1596.            "Start of a transcript of";
  1597.   ScriptOff: if (n==1) "Transcripting is already off.";
  1598.            "^End of transcript.";
  1599.   NotifyOn: "Score notification on.";
  1600.   NotifyOff: "Score notification off.";
  1601.   Places:  print "You have visited: "; rtrue;
  1602.   Objects: if (n==1) "Objects you have handled:^";
  1603.            "None.";
  1604.   Score:   if (deadflag==0) print "You have so far scored ";
  1605.            else print "In that game you scored ";
  1606.            print score, " out of a possible ", MAX_SCORE,
  1607.                  ", in ", turns, " turn";
  1608.            if (turns>1) print "s"; rtrue;
  1609.   FullScore: if (n==1)
  1610.            {   if (deadflag==0) print "The score is ";
  1611.                else             print "The score was ";
  1612.                "made up as follows:^"; }
  1613.            if (n==2) "finding sundry items";
  1614.            if (n==3) "visiting various places";
  1615.            print "total (out of ", MAX_SCORE; ")";
  1616.   Inv:     if (n==1) "You are carrying nothing.";
  1617.            print "You are carrying"; rtrue;
  1618.   Take:    if (n==1) "Taken.";
  1619.            if (n==2) "You are always self-possessed.";
  1620.            if (n==3) { print "I don't suppose "; DefArt(x1);
  1621.                        " would care for that."; }
  1622.            if (n==4) { print "You'd have to get ";
  1623.                        if (x1 has supporter) print "off "; else print "out of ";
  1624.                        DefArt(x1); " first."; }
  1625.            if (n==5) "You already have that.";
  1626.            if (n==6) { print "That seems to belong to "; DefArt(x1); "."; }
  1627.            if (n==7) { print "That seems to be a part of "; DefArt(x1); "."; }
  1628.            if (n==8) "That isn't available.";
  1629.            if (n==9) { CDefArt(x1); " is not open."; }
  1630.            if (n==10) "That's hardly portable.";
  1631.            if (n==11) "That's fixed in place.";
  1632.            if (n==12) "You're carrying too many things already.";
  1633.            print "(putting "; DefArt(x1); print " into ";
  1634.            DefArt(SACK_OBJECT); " to make room)";
  1635.   Drop:    if (n==1) "Already on the floor.";
  1636.            if (n==2) "You haven't got that.";
  1637.            if (n==3) { print "(first taking "; DefArt(x1); " off)"; }
  1638.            "Dropped.";
  1639.   Remove:  if (n==1) "It is unfortunately closed.";
  1640.            if (n==2) "But it isn't there now.";
  1641.            if (n==3) "You'll need to take it off first.";
  1642.            "Removed.";
  1643.   PutOn:   if (n==1) { print "You need to be holding ";
  1644.                        DefArt(x1); " before you can put it on top \
  1645.                       of something else."; }
  1646.            if (n==2) "You can't put something on top of itself.";
  1647.            if (n==3) { print "Putting things on "; DefArt(x1);
  1648.                        " would achieve nothing."; }
  1649.            if (n==4) "You lack the dexterity.";
  1650.            if (n==5) "(first taking it off)^";
  1651.            if (n==6) { print "There is no more room on "; DefArt(x1); "."; }
  1652.            if (n==7) "Done.";
  1653.            print "You put "; DefArt(x1); print " on "; DefArt(second); ".";
  1654.   Insert:  if (n==1) "You need to be holding it before you can put it into \
  1655.                       something else.";
  1656.            if (n==2) "That can't contain things.";
  1657.            if (n==3) "Alas, it is closed.";
  1658.            if (n==4) "You'll need to take it off first.";
  1659.            if (n==5) "You can't put something inside itself.";
  1660.            if (n==6) "(first taking it off)^";
  1661.            if (n==7) { print "There is no more room in "; DefArt(x1); "."; }
  1662.            if (n==8) "Done.";
  1663.            print "You put "; DefArt(x1); print " into "; DefArt(second); ".";
  1664.   Transfer: if (n==1) "That isn't in your possession.";
  1665.            "First pick that up.";
  1666.   EmptyT:  if (n==1) { CDefArt(x1); " can't contain things."; }
  1667.            if (n==2) { CDefArt(x1); " is closed."; }
  1668.            CDefArt(x1); " is empty already.";
  1669.   Give:    if (n==1) { print "You aren't holding "; DefArt(x1); "."; }
  1670.            if (n==2) { print "You juggle "; DefArt(x1);
  1671.                        " for a while, but don't achieve much."; }
  1672.            CDefArt(x1); " doesn't seem interested.";
  1673.   Show:    if (n==1) { print "You aren't holding "; DefArt(x1); "."; }
  1674.            CDefArt(x1); " is unimpressed.";
  1675.   Enter:   if (n==1) { print "But you're already ";
  1676.                        if (x1 has supporter) print "on ";
  1677.                        else print "in "; DefArt(x1); "."; }
  1678.            if (n==2) "That's not something you can enter.";
  1679.            if (n==3) { print "You can't get into the closed ";
  1680.                        PrintShortName(x1); "."; }
  1681.            if (n==4) "You can only get into something on the floor.";
  1682.            print "You get "; if (x1 has supporter) print "onto ";
  1683.            else print "into "; DefArt(x1); print ".^";
  1684.   GetOff:  print "But you aren't on "; DefArt(x1); " at the moment.";
  1685.   Exit:    if (n==1) "But you aren't in anything at the moment.";
  1686.            if (n==2) { print "You can't get out of the closed ";
  1687.                        PrintShortName(x1); "."; }
  1688.            "You are on your own two feet again.";
  1689.   VagueGo: "You'll have to say which compass direction to go in.";
  1690.   Go:      if (n==1)
  1691.            {   print "You'll have to get ";
  1692.                if (x1 has supporter) print "off "; else print "out of ";
  1693.                DefArt(x1); " first.";
  1694.            }
  1695.            if (n==2) "You can't go that way.";
  1696.            if (n==3) { print "You are unable to climb "; Defart(x1); "."; }
  1697.            if (n==4) { print "You are unable to descend "; Defart(x1); "."; }
  1698.            if (n==5) { print "You can't, since "; Defart(x1);
  1699.                        " is in the way."; }
  1700.            print "You can't, since "; DefArt(x1); " leads nowhere.";
  1701.   LMode1:  " is now in its normal ~brief~ printing mode, which gives \
  1702.            long descriptions of places never before visited and short \
  1703.            descriptions otherwise.";
  1704.   LMode2:  " is now in its ~verbose~ mode, which always gives long \
  1705.            descriptions of locations (even if you've been there before).";
  1706.   LMode3:  " is now in its ~superbrief~ mode, which always gives short \
  1707.            descriptions of locations (even if you haven't been there before).";
  1708.   Look:    if (n==1) { print "on"; rfalse; }
  1709.            if (n==2) { print "in"; rfalse; }
  1710.            if (n==3) { print "as"; rfalse; }
  1711.            if (n==4)
  1712.            {   print "^On "; DefArt(x1);
  1713.                WriteListFrom(child(x1),
  1714.                    ENGLISH_BIT + RECURSE_BIT + PARTINV_BIT
  1715.                    + TERSE_BIT + ISARE_BIT + CONCEAL_BIT);
  1716.                ".";
  1717.            }
  1718.            if (x1~=location)
  1719.            {   if (x1 has supporter) print "^On "; else print "^In ";
  1720.                DefArt(x1); print " you";
  1721.            }
  1722.            else print "^You";
  1723.            print " can "; if (n==5) print "also "; print "see ";
  1724.            WriteListFrom(child(x1),
  1725.                 ENGLISH_BIT + WORKFLAG_BIT + RECURSE_BIT
  1726.                 + PARTINV_BIT + TERSE_BIT + CONCEAL_BIT);
  1727.            if (x1~=location) ".";
  1728.            " here.";
  1729.   Examine: if (n==1) "Darkness, noun.  An absence of light to see by.";
  1730.            if (n==2) { print "You see nothing special about ";
  1731.                        Defart(x1); "."; }
  1732.            CDefArt(x1); print " is currently switched ";
  1733.            if (x1 has on) "on."; else "off.";
  1734.   LookUnder: if (n==1) "But it's dark.";
  1735.            "You find nothing of interest.";
  1736.   Search:  if (n==1) "But it's dark.";
  1737.            if (n==2) { print "There is nothing on "; DefArt(x1); "."; }
  1738.            if (n==3)
  1739.            {   print "On "; DefArt(x1);
  1740.                WriteListFrom(child(x1),
  1741.                    TERSE_BIT + ENGLISH_BIT + ISARE_BIT + CONCEAL_BIT);
  1742.                ".";
  1743.            }
  1744.            if (n==4) "You find nothing of interest.";
  1745.            if (n==5) "You can't see inside, since it is closed.";
  1746.            if (n==6) { CDefArt(x1); " is empty."; }
  1747.            print "In "; DefArt(x1);
  1748.            WriteListFrom(child(x1),
  1749.                TERSE_BIT + ENGLISH_BIT + ISARE_BIT + CONCEAL_BIT);
  1750.            ".";
  1751.   Unlock:  if (n==1) "That doesn't seem to be something you can unlock.";
  1752.            if (n==2) "It's unlocked at the moment.";
  1753.            if (n==3) "That doesn't seem to fit the lock.";
  1754.            print "You unlock "; DefArt(x1); ".";
  1755.   Lock:    if (n==1) "That doesn't seem to be something you can lock.";
  1756.            if (n==2) "It's locked at the moment.";
  1757.            if (n==3) "First you'll have to close it.";
  1758.            if (n==4) "That doesn't seem to fit the lock.";
  1759.            print "You lock "; DefArt(x1); ".";
  1760.   SwitchOn: if (n==1) "That's not something you can switch.";
  1761.            if (n==2) "That's already on.";
  1762.            print "You switch "; DefArt(x1); " on.";
  1763.   SwitchOff: if (n==1) "That's not something you can switch.";
  1764.            if (n==2) "That's already off.";
  1765.            print "You switch "; DefArt(x1); " off.";
  1766.   Open:    if (n==1) "That's not something you can open.";
  1767.            if (n==2) "It seems to be locked.";
  1768.            if (n==3) "It's already open.";
  1769.            if (n==4)
  1770.            {   print "You open "; DefArt(x1); print ", revealing ";
  1771.                if (WriteListFrom(child(x1),
  1772.                    ENGLISH_BIT + TERSE_BIT + CONCEAL_BIT)==0) "nothing.";
  1773.                ".";
  1774.            }
  1775.            print "You open "; DefArt(x1); ".";
  1776.   Close:   if (n==1) "That's not something you can close.";
  1777.            if (n==2) "It's already closed.";
  1778.            print "You close "; DefArt(x1); ".";
  1779.   Disrobe: if (n==1) "You're not wearing that.";
  1780.            print "You take off "; DefArt(x1); ".";
  1781.   Wear:    if (n==1) "You can't wear that!";
  1782.            if (n==2) "You're not holding that!";
  1783.            if (n==3) "You're already wearing that!";
  1784.            print "You put on "; DefArt(x1); ".";
  1785.   Eat:     if (n==1) "That's plainly inedible.";
  1786.            print "You eat "; DefArt(x1); ".  Not bad.";
  1787.   Yes, No: "That was a rhetorical question.";
  1788.   Burn:    "This dangerous act would achieve little.";
  1789.   Pray:    "Nothing practical results from your prayer.";
  1790.   Wake:    "The dreadful truth is, this is not a dream.";
  1791.   WakeOther: "That seems unnecessary.";
  1792.   Kiss:    "Keep your mind on the game.";
  1793.   Think:   "What a good idea.";
  1794.   Smell:   "You smell nothing unexpected.";
  1795.   Listen:  "You hear nothing unexpected.";
  1796.   Taste:   "You taste nothing unexpected.";
  1797.   Touch:   if (n==1) "Keep your hands to yourself!";
  1798.            if (n==3) "If you think that'll help.";
  1799.            "You feel nothing unexpected.";
  1800.   Dig:     "Digging would achieve nothing here.";
  1801.   Cut:     "Cutting that up would achieve little.";
  1802.   Jump:    "You jump on the spot, fruitlessly.";
  1803.   JumpOver, Tie: "You would achieve nothing by this.";
  1804.   Drink:   "There's nothing suitable to drink here.";
  1805.   Fill:    "But there's no water here to carry.";
  1806.   Sorry:   "Oh, don't apologise.";
  1807.   Strong:  "Real adventurers do not use such language.";
  1808.   Mild:    "Quite.";
  1809.   Attack:  "Violence isn't the answer to this one.";
  1810.   Swim:    "There's not enough water to swim in.";
  1811.   Swing:   "There's nothing sensible to swing here.";
  1812.   Blow:    "You can't usefully blow that.";
  1813.   Rub:     "You achieve nothing by this.";
  1814.   Set:     "No, you can't set that.";
  1815.   SetTo:   "No, you can't set that to anything.";
  1816.   WaveHands: "You wave, feeling foolish.";
  1817.   Wave:    if (n==1) "But you aren't holding that.";
  1818.            print "You look ridiculous waving "; DefArt(x1); ".";
  1819.   Pull, Push, Turn: if (n==1) "It is fixed in place.";
  1820.            if (n==2) "You are unable to.";
  1821.            if (n==4) "That would be less than courteous.";
  1822.            "Nothing obvious happens.";
  1823.   PushDir: if (n==1) "Is that the best you can think of?";
  1824.            if (n==2) "That's not a direction.";
  1825.            "Not that way you can't.";
  1826.   Squeeze: if (n==1) "Keep your hands to yourself.";
  1827.            "You achieve nothing by this.";
  1828.   ThrowAt: if (n==1) "Futile.";
  1829.            "You lack the nerve when it comes to the crucial moment.";
  1830.   Tell:    if (n==1) "You talk to yourself a while.";
  1831.            "This provokes no reaction.";
  1832.   Answer, Ask:  "There is no reply.";
  1833.   Buy:     "Nothing is on sale.";
  1834.   Sing:    "Your singing is abominable.";
  1835.   Climb:   "I don't think much is to be achieved by that.";
  1836.   Wait:    "Time passes.";
  1837.   Sleep:   "You aren't feeling especially drowsy.";
  1838.   Consult: print "You discover nothing of interest in "; DefArt(x1); ".";
  1839. ];
  1840.  
  1841. ! ----------------------------------------------------------------------------
  1842.